/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MODEL;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ahmed
 */
@Entity
@Table(name = "RESERVER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Reserver.findAll", query = "SELECT r FROM Reserver r"),
    @NamedQuery(name = "Reserver.findByIdPro", query = "SELECT r FROM Reserver r WHERE r.reserverPK.idPro = :idPro"),
    @NamedQuery(name = "Reserver.findByIdItem", query = "SELECT r FROM Reserver r WHERE r.reserverPK.idItem = :idItem"),
    @NamedQuery(name = "Reserver.findByDater", query = "SELECT r FROM Reserver r WHERE r.dater = :dater"),
    @NamedQuery(name = "Reserver.findByQuantiter", query = "SELECT r FROM Reserver r WHERE r.quantiter = :quantiter")})
public class Reserver implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ReserverPK reserverPK;
    @Basic(optional = false)
    @Column(name = "DATER")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dater;
    @Basic(optional = false)
    @Column(name = "QUANTITER")
    private BigDecimal quantiter;
    @JoinColumn(name = "ID_PRO", referencedColumnName = "ID_PRO", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Prospect prospect;

    public Reserver() {
    }

    public Reserver(ReserverPK reserverPK) {
        this.reserverPK = reserverPK;
    }

    public Reserver(ReserverPK reserverPK, Date dater, BigDecimal quantiter) {
        this.reserverPK = reserverPK;
        this.dater = dater;
        this.quantiter = quantiter;
    }

    public Reserver(BigDecimal idPro, BigDecimal idItem) {
        this.reserverPK = new ReserverPK(idPro, idItem);
    }

    public ReserverPK getReserverPK() {
        return reserverPK;
    }

    public void setReserverPK(ReserverPK reserverPK) {
        this.reserverPK = reserverPK;
    }

    public Date getDater() {
        return dater;
    }

    public void setDater(Date dater) {
        this.dater = dater;
    }

    public BigDecimal getQuantiter() {
        return quantiter;
    }

    public void setQuantiter(BigDecimal quantiter) {
        this.quantiter = quantiter;
    }

    public Prospect getProspect() {
        return prospect;
    }

    public void setProspect(Prospect prospect) {
        this.prospect = prospect;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reserverPK != null ? reserverPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reserver)) {
            return false;
        }
        Reserver other = (Reserver) object;
        if ((this.reserverPK == null && other.reserverPK != null) || (this.reserverPK != null && !this.reserverPK.equals(other.reserverPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "MODEL.Reserver[ reserverPK=" + reserverPK + " ]";
    }
    
}
